<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
header('Content-Type:text/html;charset=utf-8');
class Welcome extends MY_Controller 
{
    public function __construct()
    {
        parent::__construct();
        $this->load->helper('url');
        $this->load->model('welcome_model');
    }
    /*
    *傲生首页
    */
	public function index()
	{
        $nounarr = json_decode(file_get_contents(DOCUMENT."step_ao/get_noun_name_api"), true);//专业名词显示
        $dataone = json_decode(file_get_contents(DOCUMENT."step_ao/get_pro_contentone_api"), true);//此为ajax点击测边栏产品换图
        $cur_page = $this->uri->segment(3) ? $this->uri->segment(3) : 1;
        $classId = 1;//显示默认分类文章
        $withOther = json_decode(file_get_contents(DOCUMENT."step_ao/get_withOther_api"), true);//关于他们列表在此页显示
       
        $articlearr = json_decode(file_get_contents(DOCUMENT."article_ap/show_article_api?page={$cur_page}&classId={$classId}"), true);//分页数据文章
 
		$this->load->view('welcome/index', array('withOther'=>$withOther, 'article'=>$articlearr, 'pro'=>$dataone, 'type'=>'show', 'nounarr'=>$nounarr));
	}
    
    /*
    *走进傲生页
    */
    public function step_in_aosheng()
    {
         
           $this->load->view('step/step_in_aosheng');
    }
    
    /*
    *进入产品中心列表
    */
      public function product_center()
    {
        $data = json_decode(file_get_contents(DOCUMENT."step_ao/get_ao_product_api"), true);
      
        $this->load->view('product/pro-center',array('data'=>$data));
    }
    
    /*
    *根据产品ID查看此产品的详细信息
    */
    public function show_pro()
    {
        $id = $this->input->get('id');
        $data = json_decode(file_get_contents(DOCUMENT."step_ao/get_pro_content_api?id={$id}"), true);
        $this->load->view('product/center', array('proinfo'=>$data));
    }
    
    public function ajaxproone()
    {
        $id=$this->input->get('proid');
        $type=$this->input->get('type') ? $this->input->get('type') : 1;
        //$ajaxpro = json_decode(file_get_contents(DOCUMENT."step_ao/get_pro_ajaxcontentone_api?proid={$id}"), true);
       echo file_get_contents(DOCUMENT."step_ao/get_pro_ajaxcontentone_api?proid={$id}&type={$type}");
       //print_r($ajaxpro);
    }
    
    /*
    *点击首页的关于他们的more到此方法
    */
    public function show_with()
    {
        $nounarr = json_decode(file_get_contents(DOCUMENT."step_ao/get_noun_name_api"), true);//专业名词显示
        $dataone = json_decode(file_get_contents(DOCUMENT."step_ao/get_pro_contentone_api"), true);//此为ajax点击测边栏产品换图
         $withMore = json_decode(file_get_contents(DOCUMENT."step_ao/get_withOther_api?type=more"), true);
         
         $this->load->view('with/other', array('withMore'=>$withMore, 'pro'=>$dataone, 'nounarr'=>$nounarr));
    }
    
    /*
    *ajax请球关于他们无刷新分页
    */
    public function show_with_list()
    {
        $ppage = $this->input->get('ppage');
        //echo $ppage;
        echo file_get_contents(DOCUMENT."step_ao/get_withOther_api?type=more&ppage={$ppage}");
    }
    
    /*
    *由(关于他们)列表页面来此显示具体的个人信息
    */
    public function with_center()
    {
        $nounarr = json_decode(file_get_contents(DOCUMENT."step_ao/get_noun_name_api"), true);//专业名词显示
        $dataone = json_decode(file_get_contents(DOCUMENT."step_ao/get_pro_contentone_api"), true);
        $id = $this->input->get('id');
        $rowOther = json_decode(file_get_contents(DOCUMENT."step_ao/get_rowOther_api?id=".$id), true);
        $articleID = $this->input->get('id') ? $this->input->get('id') : 1;
        $row = json_decode(file_get_contents(DOCUMENT."article_ap/article_content_api?articleID=".$articleID), true);//取的文章信息
      
        $this->load->view('with/withcenter', array('rowOther'=>$rowOther, 'pro'=>$dataone, 'nounarr'=>$nounarr,'articleInfo'=>$row));
    }
    
    /*
    *用户搜索
    */
    public function search()
    {
        $dataone = json_decode(file_get_contents(DOCUMENT."step_ao/get_pro_contentone_api"), true);
        $searchID = $this->input->get('searchID') ? $this->input->get('searchID') : "no";
        $searchArr = json_decode(file_get_contents(DOCUMENT."step_ao/get_searchArticle_api?search=".$searchID), true);
        $this->load->view('search/search',array('searchArr'=>$searchArr, 'pro'=>$dataone));
    }
    
     /*
    *搜索页面分页-ajax
    */
    public function ajaxsearchpage()
    {
        $ppage = $this->input->get('ppage');
        $searchID = $this->input->get('searchID') ? $this->input->get('searchID') : "no";
        echo file_get_contents(DOCUMENT."step_ao/get_searchArticle_api?search={$searchID}&ppage={$ppage}");
        //echo '1';
    }
    
    /*
    *专业名词
    */
    public function noun()
    {
       $moreNoun = json_decode(file_get_contents(DOCUMENT."step_ao/get_moreNoun_name_api"), true);//更多的专业名词分组显示
       $nounarr = json_decode(file_get_contents(DOCUMENT."step_ao/get_noun_name_api"), true);//专业名词显示
       $dataone = json_decode(file_get_contents(DOCUMENT."step_ao/get_pro_contentone_api"), true);//此为ajax点击测边栏产品换图
       
       //exit();
        $this->load->view('noun/noun', array('pro'=>$dataone, 'nou'=>$nounarr,'moreNoun'=>$moreNoun));
    }
    
    public function test()
    {
        echo $this->uri->segment(3);
    }
    
    /*
    *连系我们
    */
    public function lxwo()
    {
        $this->load->view('lxwo/index');
    }
    
}
